When processing the list of icons for a window to add them to
_NET_WM_ICON gdk_x11_surface_set_icon_list only adds as many
icon sizes as will fit within X protocol limits.
It achieves this by keeping a running total of the number of
bytes taken up by icons already processed and bails as soon
as it goes over the limit.
The problem is, one 512x512 icon is already over the limit,
and so no icons will get added at all if the first icon in
list is 512x512.
Indeed, the code seems to assume the list is sorted from smallest
icon to biggest icon.
This commit changes the caller to sort the list.
return info;
}
+static int
+icon_size_compare (GdkTexture *a,
+ GdkTexture *b)
+{
+ int area_a, area_b;
+
+ area_a = gdk_texture_get_width (a) * gdk_texture_get_height (a);
+ area_b = gdk_texture_get_width (b) * gdk_texture_get_height (b);
+
+ return area_a - area_b;
+}
+
static GList *
icon_list_from_theme (GtkWindow *window,
const gchar *name)
0);
if (info)
{
- list = g_list_append (list, gtk_icon_info_load_texture (info));
+ list = g_list_insert_sorted (list, gtk_icon_info_load_texture (info), (GCompareFunc) icon_size_compare);
g_object_unref (info);
}
}